<?php
/**
 * 前台模块路由
 * 
 * @author birdy <freebirdy@foxmail.com>
 */

use think\Route;

//首页
Route::get('/$', "index/index/index");

//shop路径路由
Route::group('shop', function(){
    //默认定义到首页
    Route::get('/$', "index/index/index");
    
    //网站地图
    Route::rule("sitemap", 'index/index/sitemap');
    
    //商品详细页
    Route::get("item-<goods_id>", 'index/goods/detail', [], ['goods_id' => '\d+']);
    
    //商品分类路径
    Route::get(":tag", 'index/goods/index', [], ['tag' => '\w+']);

    //商品列表页详细路由
    Route::get('cate-<cate_id>-<b_id>-<a_id>-<key>-<order>-<type>-<gift>-<area_id>-<curpage>', 'index/goods/index', [], [ 
        'cate_id' => '\d+', //分类ID
        'b_id' => '\d+',    //品牌ID
        'a_id' => '\d+',    //属性ID
        'key' => '\d+',     //关键词
        'order' => '\d+',   //排序
        'type' => '\d+',    //类型ID
        'gift' => '\d+',    //礼物ID
        'area_id' => '\d+', //地区ID
        'curpage' => '\d+' //地区ID
    ]);
    
    //商品列表地区路由
    Route::get('cate-<cate_id>-<area_id>', 'index/goods/index', [], [
    'cate_id' => '\d+', //分类ID
    'area_id' => '\d+' //地区ID
    ]);
    
    //商家展示页
    Route::get("shop-<store_id>", 'index/store/index', [], ['store_id' => '\d+']);
    
    //文章列表-分类
    Route::get('article_cate-<cate_id>', 'index/article/index', [], ['cate_id' => '\d+']);
    
    //文章详细页
    Route::get("article-<article_id>", 'index/article/detail', [], ['article_id' => '\d+']);

    //不存在的页面
    Route::miss(function(){
        return '404 unknow page';
    }, 'get');
});